home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: jlilley@ix.netcom.com (John Lilley)
- Newsgroups: comp.lang.c++,de.comp.lang.c++,ualberta.cmput.201
- Subject: Re: Another function pointer from a class question?!
- Date: 1 Apr 1996 17:23:48 GMT
- Organization: Netcom
- Message-ID: <4jp3f4$5o5@dfw-ixnews3.ix.netcom.com>
- References: <4jls2p$bac@pulp.ucs.ualberta.ca>
- NNTP-Posting-Host: den-co6-02.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-NETCOM-Date: Mon Apr 01 11:23:48 AM CST 1996
- X-Newsreader: WinVN 0.99.7
-
- In article <4jls2p$bac@pulp.ucs.ualberta.ca>, ryangall@gpu.srv.ualberta.ca
- says...
- >
- >
- >I have an error that I am unsure of.....I want to have a derived class
- >that I can pass a function pointer that I will use in a print function.
- >If I dont use the print function, and just have the class print off the
- >elements in the main function, then it works fine....the class itself
- >works
- >well....its just that I get a linker error when I try and run it when
- >using
- >the print function.
-
- >in list.h....I have the pure virtual class
- >
- >template<class T>
- >class list{
- >
- > public:
- >
- > virtual T Add(T)=0;
- > virtual T Remove(T)=0;
- > virtual T POPfirst()=0;
- > virtual T POPlast()=0;
- > virtual int Inlist(T)=0;
- > virtual int isempty()=0;
- > virtual void print(void (*)(T))=0;
- >
- >};
- >
- >#include "list.h"
- >
- >template<class T>
- >// I used to have this next line, as the delaration but it didnt work,
- >//class dl_list : public list<T>{
- >// it kept saying that I couldnt use a abstract class directly.
-
-
- Try this again, just make sure that when you declare
-
- template <class T> class dl_list : public list<T> {...}
-
- That you override *all* of the virtual methods of list<T>.
-
- john lilley
-
-
-